package com.cqqec.boot.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Dish {
    private int id;
    private String categoryName;
    private String name;
    private int price;
    private String status;
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
    //格式化时间
    //获取创建时间
    public String getFormattedCreateTime() {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return createTime.format(formatter);
    }
    //获取更新时间
    public String getFormattedUpdateTime() {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return updateTime.format(formatter);
    }
}
